package com.xiaoshuidi.cloud.module.finance.dal.mysql.finance;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xiaoshuidi.cloud.framework.mybatis.core.mapper.BaseMapperX;
import com.xiaoshuidi.cloud.module.finance.dal.dataobject.finance.FinanceThirdWithdrawDO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface FinanceThirdWithdrawMapper extends BaseMapperX<FinanceThirdWithdrawDO> {
    default int updateStatusByTXNo(String withdrawNo, String status, FinanceThirdWithdrawDO update) {
        return update(update, new LambdaQueryWrapper<FinanceThirdWithdrawDO>().eq(FinanceThirdWithdrawDO::getWithdrawNo, withdrawNo)
                .eq(FinanceThirdWithdrawDO::getStatus, status));
    }

    default int updateByNoAndAmount(String withdrawNo, String balance, FinanceThirdWithdrawDO update){
        return update(update, new LambdaQueryWrapper<FinanceThirdWithdrawDO>().eq(FinanceThirdWithdrawDO::getWithdrawNo, withdrawNo)
                .eq(FinanceThirdWithdrawDO::getBalance,  Long.valueOf(balance)));
    }

    default FinanceThirdWithdrawDO getByNoAndAmount(String withdrawNo, String balance){
        return selectOne(new LambdaQueryWrapper<FinanceThirdWithdrawDO>().eq(FinanceThirdWithdrawDO::getWithdrawNo, withdrawNo)
                .eq(FinanceThirdWithdrawDO::getBalance, Long.valueOf(balance)));
    }
}
